package com.gugee.notice;

import com.xiguaji.boot.data.rdb.aggregate.Aggregate;
import com.xiguaji.boot.toolkit.DateTimeUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class DbcConfig {

    /*@Bean("oldTemplate")
    public JdbcTemplate oldTemplate(@Qualifier("oldDataSource") DataSource dataSource) {
        return new JdbcTemplate(dataSource);
    }*/

    @Bean("oldDataSource")
    @ConfigurationProperties("spring.old")
    public DataSource oldDataSource() {
        return DataSourceBuilder.create().build();
    }

    /*@Bean("newTemplate")
    public JdbcTemplate newTemplate(@Qualifier("newDataSource") DataSource dataSource) {
        return new JdbcTemplate(dataSource);
    }*/

    @Bean("newDataSource")
    @ConfigurationProperties("spring.new")
    public DataSource tDataSource() {
        return DataSourceBuilder.create().build();
    }
}
